<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE">
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
    <title>数据核对</title>
</head>
<script src="/js/jquery-3.3.1.js"></script>
<body>

<input id='img1' type="file" name="img1" />
<button onclick="uploadFile1();" >上传1</button>
<p id="re1"></p>
<br><br><br>
<input id='img2' type="file" name="img2" />
<button onclick="uploadFile2();" >上传2</button>
<p id="re2"></p>
<br><br><br>
<a href="/excel/compare.do">核对数据并下载报表</a>

</body>
<script>
    function uploadFile1() {
        alert("上传1");
        var fileobj = $("#img1")[0].files[0];
        console.log(fileobj);
        var form = new FormData();
        form.append("excelFile", fileobj);
        form.append("uesr", 'alex');
        $.ajax({
            type: 'POST',
            url: '/excel/import.do',
            data: form,
            processData: false,
            contentType: false,
            success:function (re) {
                //响应成功后的回调函授,re是接收服务器数据的形参
                $("#re1").text(re)
            }
        })
    }
    function uploadFile2() {
        alert("上传2");
        var fileobj = $("#img2")[0].files[0];
        console.log(fileobj);
        var form = new FormData();
        form.append("excelFile", fileobj);
        form.append("uesr", 'alex');
        $.ajax({
            type: 'POST',
            url: '/excel/import.do',
            data: form,
            processData: false,
            contentType: false,
            success:function (re) {
                //响应成功后的回调函授,re是接收服务器数据的形参
                $("#re2").text(re)
            }
        })
    }
</script>
</html>